<template>
	<div class="ordermanage_parent">
		<el-radio-group class="headradioBtn_type" v-model="type">
			<el-radio-button label="全部订单" class="first">
				<!-- <el-badge hidden :value="200" :max="99" class="badgeNumber">
					<span></span>
				</el-badge> -->
			</el-radio-button>
			<el-radio-button label="订单审核" class="last">
				<el-badge :hidden="checkOrderCount<=0" :value="checkOrderCount" :max="99" class="badgeNumber">
					<span>订单审核</span>
				</el-badge>
			</el-radio-button>
		</el-radio-group>
		
		<ordermanageAllorders v-if="type=='全部订单'" ref="ordermanageAllorders"></ordermanageAllorders>
		<ordermanageCheckorders v-else ref="ordermanageCheckorders" @setCheckOrderCount="setCheckOrderCount"></ordermanageCheckorders>
	</div>
</template>

<script>
	import ordermanageAllorders from './ordermanage_allorders'
	import ordermanageCheckorders from './ordermanage_checkorders'
	let vm;
	export default{
		components:{ordermanageAllorders,ordermanageCheckorders},
		data(){
			return {
				type:'全部订单',
				checkOrderCount:0
			};
		},
		methods:{
			init(){
				this.getCheckOrderCount();
			},
			campusChange : function(campusId) { //校区改变
				if(this.$refs.ordermanageAllorders&&this.type=='全部订单'){
					this.getCheckOrderCount();
					this.$refs.ordermanageAllorders.campusChangeHandle(campusId);
				}
				else if(this.$refs.ordermanageCheckorders){
					this.$refs.ordermanageCheckorders.campusChangeHandle(campusId);
				}
			},
			getCheckOrderCount(){
				vm.checkOrderCount=0;
				api.orderManage_queryInList({
					campusId:this.$store.state.campusId,
					pageSize:10,
					currPage:1,
					keyName:'',
					orderState:0,//0-全部，1-待支付，2-交易成功，3-交易关闭
					auditState:1,//0-全部，1-待审核，2-已审核
					auditType:1,//1-收费，2-退费
				})
				.then(function(d){
					if(d.result=='操作成功'){
						vm.checkOrderCount+=d.totalCount;
					}
				});
				api.orderManage_queryInList({
					campusId:this.$store.state.campusId,
					pageSize:10,
					currPage:1,
					keyName:'',
					orderState:0,//0-全部，1-待支付，2-交易成功，3-交易关闭
					auditState:'1,4',//0-全部，1-待审核，2-已审核
					auditType:2,//1-收费，2-退费
				})
				.then(function(d){
					if(d.result=='操作成功'){
						vm.checkOrderCount+=d.totalCount;
					}
				});
			},
			setCheckOrderCount(n){
				vm.checkOrderCount=n;
			}
		},
		mounted(){
			vm=this;
			this.init();
		},
		computed:{
			
		},
		watch:{

		}
	}
</script>

<style lang="scss">
	.ordermanage_parent{
		.headradioBtn_type{
			// width: 8rem;
			// position: absolute;
			// top: -0.8rem;
			// left: .45rem;
			display: block;
			margin: 0 auto;
			width: 15.48rem;

			.badgeNumber{
				// margin-top: 0.05rem;
 		 		// margin-right: 0;
			}
			.el-radio-button{
				margin-left: 0.2rem !important;
				user-select: none;
			}
			.el-radio-button.first{
				margin-left: 0rem !important;
			}
			.el-radio-button__inner{
				width: 1.2rem !important;
				// border-top: 0;
				// border-bottom: 0;
				height: 0.60rem !important;
				// line-height: 0.25rem !important;
				// font-size: 0.18rem !important;
				border: unset !important;
				border-radius:unset !important;
				background: unset !important;
				color: unset !important;
				line-height: 0.45rem !important;
				font-size: 0.18rem !important;
			}
			.el-radio-button__orig-radio:checked + .el-radio-button__inner{
				box-shadow:unset !important;
				font-weight: bold !important;
				border-bottom: 0.02rem solid #3885f8 !important;
			}
		}
		// .orderTypeSymbol{
		// 	display: block;
		// 	height: 0.2rem;
		// 	line-height: 0.2rem;
		// 	font-size: 0.12rem;
		// 	border-radius: 0.05rem;
		// 	width: 0.23rem;
		// 	padding: 0 0.05rem;
		// 	text-align: center;
		// 	cursor:pointer;
		// 	user-select: none;
		// }
		.orderTypeSymbol{
			display: block;
			height: 0.26rem;
			line-height: 0.26rem;
			font-size: 0.16rem;
			border-radius: 0.04rem;
			width: 0.36rem;
			// padding: 0 0.05rem;
			text-align: center;
			cursor:pointer;
			user-select: none;
			// font-family: 'MicrosoftYaHei-Bold';
			font-weight: bold;
			font-stretch: normal;
			letter-spacing: 0px;
		}
		// 课
		.orderTypeSymbol[type='1']{
			background-color: #daf1ff;
			color: #1f76f7;
		}
		//商
		.orderTypeSymbol[type='2']{
			background-color: #edefff;
			color: #487ef9;
		}
		//订
		.orderTypeSymbol[type='3']{
			background-color: #e8f3dc;
			color: #87c143;
		}
		//餐
		.orderTypeSymbol[type='4']{
			background-color: #ffe9e9;
			color: #fa7777;
		}
		.coverTable{
			td{
				white-space: pre-line !important;
			}
		}
		.tbody{
			tr{
				background-color: white !important;
			}
			tr[rowIndex='odd']{
				background-color: #f7f9fc !important;
			}
			tr[rowhover='1']{
				background-color: #e4efff !important;
			}
		}
		
	}
</style>